/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.cardarus.operatingsystem.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;

/**
 *This class registers a transaction of
 * points for a customer account.
 *
 * @author Javier Snaider
 */
@Entity
public class PointsTransaction implements Serializable {
    /**
     * the id of the transaction
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;
    /**
     * the date of the transaction
     */
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date movDate;
    /**
     * the RewardMembership account of the Customer
     */
    @ManyToOne
    private RewardMembership account;
    /**
     * the amount of points
     */
    private int amount;
    /**
     * the description of this transaction
     */
    private String description;
/**
 *
 * @return the id
 */
    public int getId() {
        return id;
    }
    /**
     * sets the id
     * @param id
     */
    public void setId(int id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) getId();
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PointsTransaction)) {
            return false;
        }
        PointsTransaction other = (PointsTransaction) object;
        if (this.getId() != other.getId()) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "PointsTransaction[id=" + getId() + "]";
    }

    /**
     * @return the movDate
     */
    public Date getMovDate() {
        return movDate;
    }

    /**
     * @param movDate the movDate to set
     */
    public void setMovDate(Date movDate) {
        this.movDate = movDate;
    }

    /**
     * @return the account
     */
    public RewardMembership getAccount() {
        return account;
    }

    /**
     * @param account the account to set
     */
    public void setAccount(RewardMembership account) {
        this.account = account;
    }

    /**
     * @return the amount
     */
    public int getAmount() {
        return amount;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(int amount) {
        this.amount = amount;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

}
